var t = getApp();

Page({
    data: {
        list: [],
        current_page: 1,
        last_page: 1
    },
    onLoad: function(t) {
        this.getData();
    },
    getData: function() {
        var a = this;
        t._postNetWork({
            url: t.getNetAddresss("plugin.area-merchant.frontend.modules.agent.controllers.records.index"),
            success: function(t) {
                1 == t.data.result && a.setData({
                    list: t.data.data.page_list.data,
                    last_page: t.data.data.page_list.last_page
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.current_page >= this.data.last_page || this.getMoreData();
    },
    getMoreData: function() {
        var a = this, e = this.data.current_page + 1;
        t._postNetWork({
            url: t.getNetAddresss("plugin.area-merchant.frontend.modules.agent.controllers.records.index"),
            data: {
                page: e
            },
            success: function(t) {
                var n = t.data.data.page_list;
                if (1 == t.data.result) {
                    var o = a.data.list.concat(n.data);
                    a.setData({
                        current_page: e,
                        last_page: n.last_page,
                        list: o
                    });
                }
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    onShareAppMessage: function() {}
});